home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
101-125
/
scopedisk108
/
dedit
/
stringlib.doc
< prev
next >
Wrap
Text File
|
1995-03-19
|
6KB
|
204 lines
This file documents the usage of the functions in string.library
*********************************************************************
LtoX
Convert a long to a null terminated string of 8 hex characters.
Template
LtoX(num, string)
d0 a0
inputs:
long num; /* long to be converted */
char *string; /* pointer to an array of char */
*********************************************************************
XtoL
Convert a hex string to a long
Template
num = XtoL(hex);
d0 a0
input:
char *hex; /* pointer to hexstring */
return:
long num; /* result */
*********************************************************************
StrReq
Put a requester up on a screen and return length of entered string
Template
length = StrReq(strreq);
d0 a0
input:
struct StrRequester *strreq; /* pointer to StrRequester struct */
return:
long length; /* length of entered string */
The StrRequester structure is set up like this...
struct StrRequester
{
SHORT sr_LeftEdge; /* Top Left corner */
SHORT sr_TopEdge; /* of the requester */
long sr_MaxOutWidth; /* Maximum length of string that will be accepted */
char *sr_Prompt; /* Prompt that will be displayed in the requester */
char *sr_OutBuff; /* Buffer for entered string */
struct Screen *sr_Screen; /* screen to put requester on or NULL for WB screen */
};
*********************************************************************
Center
Center a string in a specified width with a pad character
Template
Center(source, dest, width, pad);
a0 a1 d0 d1
inputs:
char *source; /* string to center */
char *dest; /* centered string. must be at least width+1 long */
int width; /* width to center string in */
char pad; /* character to pad the string with */
*********************************************************************
CtoP
Check if a character is printable, if not change it to '·' (ALT+8)
Template
char = CtoP((int)char);
a0
input:
char char;
return:
char char;
*********************************************************************
BtoCStr
Convert a BPTR to a null terminated C string.
Template
length = BtoCStr(source, dest, maxlen);
d0 a0 a1 d0
inputs:
BPTR source; /* BPTR to a BSTR */
char *dest; /* C string */
int maxlen; /* maximum length of C string */
return:
long length; /* length of C string */
*********************************************************************
MidStr
Return a part of source string from start for length characters.
Template
length = MidStr(source, dest, start, length);
d0 a0 a1 d0 d1
inputs:
char *source; /* string to cut up */
char *dest; /* requested piece of source (null terminated) */
int start; /* starting character */
int length; /* number of characters to copy */
return:
long length; /* length of output string */
*********************************************************************
LeftStr
Return the leftmost length characters of source string.
Template
length = LeftStr(source, dest, len);
d0 a0 a1 d0
inputs:
char *source; /* string to cut up */
char *dest; /* leftmost piece of source (null terminated) */
int len; /* number of characters to copy */
return:
long length; /* length of output string */
*********************************************************************
RightStr
Return the rightmost length characters of source string.
Template
length = RightStr(source, dest, len);
d0 a0 a1 d0
inputs:
char *source; /* string to cut up */
char *dest; /* rightmost piece of source (null terminated) */
int len; /* number of characters to copy */
return:
long length; /* length of output string */
*********************************************************************
InsertStr
Insert ins string into source string.
Template
length = LeftStr(source, dest, ins, start);
d0 a0 a1 d0 d1
inputs:
char *source; /* string to cut up */
char *dest; /* result string (null terminated) */
char *ins; /* string to insert */
int start; /* position to insert the string */
return:
long length; /* length of output string */
*********************************************************************
DelStr
Cut a piece out of the middle of the source string.
Template
length = DelStr(source, dest, start, len);
d0 a0 a1 d0 d1
inputs:
char *source; /* string to cut up */
char *dest; /* result string (null terminated) */
int start; /* where to start cutting */
int len; /* number of characters to copy */
return:
long length; /* length of output string */
*********************************************************************
This library was written entirely in assembly using the C.A.P.E
assembler. I have tried to keep it as compact as possible.
I have only programed this library using the Lattice 5.0 C compiler.
I have included the include file stringlib.h which defines function
prototypes and pragmas so there is no need for a linker library. Simply
include strinlib.h, OpenLibrary() string.library, and call whatever
function you need.
----------------------------------------------------------------------
Send questions or comments to...
Mike Ruble CompuServe ID: 71310,1237